#include<iostream>
#include<assert.h>
#include<unistd.h>
using namespace std;

int main()
{
   int id = fork();
   assert(id >= 0);
   if(id == 0)
   {
      while(1)
      {
         cout << "我是子进程，我的pid是" << getpid() << "，我的ppid是" << getppid() << endl;
         sleep(1);
      }
   }
   else
   { 
      while(1)
      {
         cout << "我是父进程，我的pid是" << getpid() << "，我的ppid是" << getppid() << endl;
         sleep(1);
      }
   }
   return 0;
}
